<template>
  <div class="row-main">
    <el-table :data="tableData" class="row-main-table" :header-cell-style="{ 'background':$store.state.app.tableBgColor,'color':'#606266' }">
      <el-table-column align='center' prop="id" label="轮询ID" ></el-table-column>
      <el-table-column align='center' prop="totalNum" label="总数">
        <template v-slot="{ row, rowIndex }">
          <div style="color:blue">{{row.allNum}}</div>
        </template>
      </el-table-column>
      <el-table-column align='center' prop="successNum" label="成功数">
        <template v-slot="{ row, rowIndex }">
          <div style="color:green">{{row.successNum}}</div>
        </template>
      </el-table-column>
      <el-table-column align='center' prop="failNum" label="失败数">
        <template v-slot="{ row, rowIndex }">
          <div style="color:red">{{row.failNum}}</div>
        </template>
      </el-table-column>
      <el-table-column align='center' prop="" label="实际总数">
        <template v-slot="{ row, rowIndex }">
          <div style="color:darkgoldenrod">{{row.failNum+row.successNum}}</div>
        </template>
      </el-table-column>
      <el-table-column align='center' prop="reqTime" label="请求时间"></el-table-column>
      <el-table-column align='center' prop="type" label="类型"></el-table-column>
      <el-table-column align='center' prop="insertTime" label="轮询时间"></el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      class="row-main-pager"
      :current-page.sync="page.current"
      :page-size="page.size"
      :total="page.total"
      layout="total, sizes, prev, pager, next, jumper"
      background></el-pagination>
  </div>
</template>

<script>
  import {listTrainingRotation} from '@/api/getData'
    export default {
        name: "aroundCheck",
      data() {
        return {
          cardNumber: "",
          loading: false,
          flag: '',
          buttonRetryLoading: false,
          tableData: [],
          page: {
            current: 1,
            size: 10,
            total: 0
          }
        }
      },
      created() {
        this.findList()
      },
      methods: {
        handleCurrentChange(currentPage) {
          this.page.current = currentPage;
          this.findList()
        },
        handleSizeChange(pageSize){
          this.page.current = 1;
          this.page.size = pageSize;
          this.findList()
        },

        findList(){
          listTrainingRotation({page: this.page}).then(response => {
            this.tableData=response.data.records
            this.page.total = response.data.total
            this.loading = false
          }).catch(e => {
            this.loading = false
          })
        }
      }
    }
</script>

<style scoped>

</style>
